using Godot;
using System;

public partial class Squat : Node,StateNode
{
	public Enemy enemy;

    public Timer timer;

    public override void _Ready()
	{
		enemy = GetNode<Enemy>("/root/Main/Enemy");

        timer = GetNode<Timer>("Timer");
        timer.Timeout+=OnTimeout;
	}

    private void OnTimeout()
    {
        enemy.SwitchTo("DashOnFloor");
    }

	public void OnEnter()
    {
        enemy.GetNode<AnimatedSprite2D>("AnimaEnemy").Animation = "squat";

        timer.Start();
    }

    public void OnExit()
    {
    }

    public void OnUpdate(float delta)
    {
        if(enemy.Health<=0)
            enemy.SwitchTo("Dead");
    }

}
